package com.gof.example.state;

import java.util.ArrayList;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * Created by zhiyuan on 2018/5/13 16:05.
 * haiming.fei@tongdun.cn
 */
public class Gamer {

    private int point = 0;
    private String fullName;
    private State actorState;
    private List<String> functions = new ArrayList<>();

    public Gamer(int point, String fullName) {
        this.point = point;
        this.fullName = fullName;
        actorState = new PrimaryState(this);
    }

    public void addFunc(String funcName) {
        functions.add(funcName);
    }

    public void removeFunc(String funcName) {
        functions.remove(funcName);
    }

    public void clearFuncs() {
        functions.clear();
    }

    public void setActorState(State actorState) {
        this.actorState = actorState;
    }

    public int getPoint() {
        return point;
    }

    public void setPoint(int point) {
        this.point = point;
    }

    public void increasePoint(int point) {
        actorState.increasePoint(point);
    }

    public void display() {
        System.out.println("作战人: " + fullName + ", 积分: " + point);
        System.out.println("============================");
        for (String f : functions) {
            System.out.println(f);
        }
    }
}
